package com.chii.order.client;


import com.chii.order.client.impl.UserClientFallback;
import com.chii.order.po.ResponeInfo;
import com.chii.order.po.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "sc-user", fallback = UserClientFallback.class)
public interface UserClient {

    @RequestMapping(value = "/getUserByUsername/{username}", method = RequestMethod.GET)
    ResponeInfo<User> getUserByUsernameFromUser(@PathVariable("username") String username);

    @RequestMapping(value = "/userRole", method = RequestMethod.POST)
    ResponeInfo insertRole(@RequestParam("userId") Integer userId, @RequestParam("roleName") String roleName);

    @RequestMapping(value = "/userRole", method = RequestMethod.DELETE)
    ResponeInfo delRole(@RequestParam("userId") Integer userId,@RequestParam("roleName") String roleName);

}